﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MethodWorx.CMS.Linq
{
    public class GenericStorageEnumerable<T> : IEnumerable<T>
        where T : class
    {
        private IEnumerable<LinqGenericStorage> source;

        #region IEnumerable<T> Members
        public GenericStorageEnumerable(IEnumerable<LinqGenericStorage> source)
        {
            if (source == null)
                throw new ArgumentNullException("source");

            this.source = source;
        }

        public IEnumerator<T> GetEnumerator()
        {
            return new GenericStorageEnumerator<T>(this.source.GetEnumerator());
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return new GenericStorageEnumerator<T>(this.source.GetEnumerator());
        }

        #endregion
    }
}
